﻿using GN.Pay.TradeChannel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GN.Pay.Core.Values.Channel
{
    /// <summary>
    /// 
    /// </summary>
    public class TradeOrderQueryResultValue : ITradeOrderQueryResult
    {
        public string BankName { get; set; }

        public string BankType { get; set; }

        public string Body { get; set; }

        public string ChannelId { get; set; }

        public string ChannelMode { get; set; }

        public string ChannelName { get; set; }

        public string ExtraParam { get; set; }

        public decimal OrderMoney { get; set; }

        public string OrderNo { get; set; }

        public string OtherPartyAccount { get; set; }

        public string OtherPartyAccountId { get; set; }

        public decimal PayFee { get; set; }

        public DateTime PayTime { get; set; }

        public decimal RefundFee { get; set; }

        public decimal RefundMoney { get; set; }

        public string Subject { get; set; }

        public string TradeNo { get; set; }

        public void Validation()
        {
            if (string.IsNullOrWhiteSpace(this.OrderNo))
            {
                this.ThrowChannelValidationException
                  ("OrderNo 为 null 或空白");
            }
            if (this.OrderMoney <= 0)
            {
                this.ThrowChannelValidationException
                  ("OrderMoney 小于或等于零");
            }
            if (this.PayFee < 0)
            {
                this.ThrowChannelValidationException
                  ("PayFee 小于零");
            }
            if (this.RefundMoney < 0)
            {
                this.ThrowChannelValidationException
                  ("RefundMoney 小于零");
            }
            if (this.RefundFee < 0)
            {
                this.ThrowChannelValidationException
                   ("RefundFee 小于零");
            }
        }
    }
}
